<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <title>知识交流平台</title>
    <link href="/components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="/styles/public.css" rel="stylesheet" type="text/css" />
    {{{_sections.head}}}
</head>
<body>
<header>
    <nav class="navbar navbar-default" role="navigation">
        <!-- We use the fluid option here to avoid overriding the fixed width of a normal container within the narrow content columns. -->
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-6">
                    <span class="sr-only">顶部导航</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/">知识交流平台</a>
            </div>

            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-6">
                <ul class="nav navbar-nav">
                    {{#each category}}
                        <li class="{{setActiveCategory @key ../curCategory}}"><a href="/category/{{@key}}">{{this}}</a></li>
                    {{/each}}
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {{#if user}}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{user.userName}}<span class="caret"></span></a>
                            <ul class="dropdown-menu" role="menu">
                                <li><a href="/user/{{user.userName}}"><span class="glyphicon glyphicon-user"></span><span class="menu-text">个人中心</span></a></li>
                                <li><a href="/user/{{user.userName}}/setting"><span class="glyphicon glyphicon-info-sign"></span><span class="menu-text">用户设置</span></a></li>
                                <li class="divider"></li>
                                <li><a href="/user/{{user.userName}}/logout"><span class="glyphicon glyphicon-log-out"></span><span class="menu-text">退出</span></a></li>
                            </ul>
                        </li>
                    {{else}}
                        <li><a href="/login">登录</a></li>
                        <li><a href="/register">注册</a></li>
                    {{/if}}
                </ul>
            </div><!-- /.navbar-collapse -->
        </div>
    </nav>
</header>
{{{body}}}
<footer>
    <div class="container text-center">
        <hr>
        <p><a href="https://github.com/CJ-Zheng1023" target="_blank">@AfterWin</a>&nbsp;&nbsp;<a href="https://cj-zheng1023.github.io/" target="_blank">@本人简历</a></p>
        <p>已在Github开源：<a href="https://github.com/CJ-Zheng1023/knowledge-forum" target="_blank">源码</a></p>
        <p>网站备案号：<a href="http://www.beian.miit.gov.cn" target="_blank">京ICP备17038081号-1</a></p>
    </div>
</footer>
<script src="/components/jquery/dist/jquery.min.js"></script>
<script src="/components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/scripts/common.js"></script>
{{{_sections.js}}}
</body>
</html>